<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>距离活动开始时间</title>
</head>
<body>
    <div class="showtime"></div>

    <script>
        var t =null;
        t = setTimeout(countDown,1000); //开始运行
        function countDown(time) {
            clearTimeout(t); //清除定时器
            var nowTime = +new Date();
            var inputTime = +new Date(time);
            var times = (inputTime - nowTime)/1000;
            var d = parseInt((times / 60 /60 % 24));
            d = d < 10 ? '0'+d : d;
            var h = parseInt(times / 60 / 60 % 24);
            h = h < 10 ? '0'+h : h;
            var m = parseInt(times /60 % 60);
            m = m < 10 ? '0'+m : m;
            var s = parseInt(times % 60);
            s = s < 10 ? '0'+s : s;
            return  "距离活动开始时间：" + d + "天" + h + "时"+ m + "分"+s+ "秒";
        t=setTimeout(countDown);
        }
        console.log(countDown('2060-6-10 17:00:00'))
        var date = new Date();
        console.log(date);
    </script>
</body>
</html>